<template>
  <div id="home">
    <el-container>
      <el-aside width="auto">
        <el-menu default-active="1" class="el-menu-vertical-demo" :collapse="isCollapse">
          <el-menu-item index="1" @click="handleOpen('1')">
            <i class="el-icon-menu"></i>
            <span slot="title">客户协议</span>
          </el-menu-item>
          <el-menu-item index="2" @click="handleOpen('2')">
            <i class="el-icon-menu"></i>
            <span slot="title">联系人</span>
          </el-menu-item>
          <el-menu-item index="3" @click="handleOpen('3')">
            <i class="el-icon-setting"></i>
            <span slot="title">佣金</span>
          </el-menu-item>
          <el-menu-item index="4" @click="handleOpen('4')">
            <i class="el-icon-setting"></i>
            <span slot="title">当前账务</span>
          </el-menu-item>

          <el-menu-item index="5" @click="handleOpen('6')">
            <i class="el-icon-setting"></i>
            <span slot="title">入住记录</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header style="height: 50px;">
          <el-button v-if="isCollapse" @click="toggleCollapse()">展开</el-button>
          <el-button v-if="!isCollapse" @click="toggleCollapse()">收起</el-button>
        </el-header>
        <el-main>
          <div v-if="tablekey=='1'">
            <el-form :inline="true" :model="agreementFrom" @keyup.enter.native="getDataAgreementList()">
              <el-form-item>
                <el-input v-model="agreementFrom.name" placeholder="协议主题" clearable></el-input>
              </el-form-item>

              <el-form-item>
                <el-button @click="getDataAgreementList()">查询</el-button>
                <el-button v-if="isAuth('hotel:agreement:save')" type="danger" @click="showAgreement('',1)">新增</el-button>
              </el-form-item>
            </el-form>
            <el-table :data="dataList" border="" v-loading="dataListLoading" @selection-change="selectionChangeHandle"
              style="width: 100%;">
              <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
              <el-table-column prop="typeName" header-align="center" align="center" label="协议类型"></el-table-column>
              <el-table-column prop="name" header-align="center" align="center" label="协议主题"></el-table-column>
              <el-table-column prop="khSigning" header-align="center" align="center" label="客户签约人"></el-table-column>
              <el-table-column prop="bsSigning" header-align="center" align="center" label="本司签约人"></el-table-column>
              <el-table-column prop="no" header-align="center" align="center" label="协议单号"></el-table-column>
              <el-table-column prop="qyTime" header-align="center" align="center" label="签约时间"></el-table-column>
              <el-table-column prop="discount" header-align="center" align="center" label="折扣值"></el-table-column>
              <!-- 	<el-table-column prop="operation" header-align="center" align="center" label="操作人"></el-table-column> -->
              <el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"></el-table-column>
              <el-table-column prop="a" header-align="center" align="center" label="协议房价">
                <template slot-scope="scope">
                  <el-button type="primary" @click="agreedrate(scope.row)">查看</el-button>
                </template>
              </el-table-column>

              <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
                <template slot-scope="scope">
                  <el-button type="text" size="small" @click="showAgreement(scope.row.id,1)">修改</el-button>
                  <el-button type="text" size="small" @click="deleteAgreement(scope.row.id,1)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>

          <div v-if="tablekey=='2'">
            <el-form :inline="true" :model="searchTAgreementContactsForm" ref="searchTAgreementContactsForm"
              @keyup.enter.native="contactsFilter()">
              <el-form-item label="名称" prop="name">
                <el-input class="filter-item input-normal" v-model="searchTAgreementContactsForm.name"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button size="small" type="primary" icon="el-icon-search" @click="contactsFilter()">查询</el-button>
                <el-button v-if="isAuth('hotel:agreement:save')" type="danger" @click="showAgreement('',2)">新增</el-button>
              </el-form-item>
            </el-form>
            <el-table @sort-change="selectionChangeHandle" :data="dataList" v-loading="dataListLoading"
              element-loading-text="加载中...">
              <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
              <el-table-column align="center" label="名称">
                <template slot-scope="scope">
                  <span>{{scope.row.name}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="性别">
                <template slot-scope="scope">
                  <span>{{scope.row.sex}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="出生日期">
                <template slot-scope="scope">
                  <span>{{scope.row.birthDate}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="称呼">
                <template slot-scope="scope">
                  <span>{{scope.row.calls}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="部门">
                <template slot-scope="scope">
                  <span>{{scope.row.dept}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="公司电话">
                <template slot-scope="scope">
                  <span>{{scope.row.officePhone}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="手机">
                <template slot-scope="scope">
                  <span>{{scope.row.phone}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="家庭电话">
                <template slot-scope="scope">
                  <span>{{scope.row.homePhone}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="职务">
                <template slot-scope="scope">
                  <span>{{scope.row.post}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="邮编">
                <template slot-scope="scope">
                  <span>{{scope.row.ybCode}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="Email">
                <template slot-scope="scope">
                  <span>{{scope.row.email}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="地址">
                <template slot-scope="scope">
                  <span>{{scope.row.address}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="爱好">
                <template slot-scope="scope">
                  <span>{{scope.row.hobby}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="备注">
                <template slot-scope="scope">
                  <span>{{scope.row.remake}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="更新时间">
                <template slot-scope="scope">
                  <span>{{scope.row.updateTime}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" fixed="right" label="操作">
                <template slot-scope="scope">
                  <el-button type="text" size="small" @click="showAgreement(scope.row.id,2)">修改</el-button>
                  <el-button type="text" size="small" @click="deleteAgreement(scope.row.id,2)">删除</el-button>
                </template>
              </el-table-column>

            </el-table>

          </div>

          <div v-if="tablekey=='3'">
            <el-tabs v-model="activeName" type="card" @tab-click="handleyjClick">
              <el-tab-pane label="未返" name="first"></el-tab-pane>
              <el-tab-pane label="已返" name="second"></el-tab-pane>
            </el-tabs>
            <div v-if="indexs=='0'">
              <el-form :inline="true" :model="searchTAgreementCommissionForm" ref="searchTAgreementCommissionForm">

                <el-form-item label="记佣时间" prop="jyDate">
                  <el-date-picker v-model="searchTAgreementCommissionForm.jyDate" type="daterange" range-separator="至"
                    start-placeholder="开始日期" value-format="yyyy-MM-dd" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <!-- <el-form-item label="返佣状态" prop="status">
								<el-select v-model="searchTAgreementCommissionForm.status" clearable  placeholder="请选择">
									<el-option v-for="item in optionsstatus" :key="item.value" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item> -->
                <el-form-item>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="commissionFilter('1')">查询</el-button>
                  <!--  	<el-button v-if="isAuth('hotel:agreement:save')" type="danger" @click="showAgreement('',3)">新增</el-button> -->
                </el-form-item>
                <el-form-item>
                  <el-button size="small" type="primary" icon="el-icon-coin" @click="fanyong()">返佣</el-button>
                  <!--  	<el-button v-if="isAuth('hotel:agreement:save')" type="danger" @click="showAgreement('',3)">新增</el-button> -->
                </el-form-item>
              </el-form>


              <el-table @sort-change="selectionChangeHandle" :data="dataList" @select="selecttables" @select-all="selectalls"
                v-loading="dataListLoading" element-loading-text="加载中...">
                <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
                <el-table-column align="center" label="房间号">
                  <template slot-scope="scope">
                    <span>{{scope.row.name}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="记佣时间">
                  <template slot-scope="scope">
                    <span>{{scope.row.jyDate}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="需返佣金">
                  <template slot-scope="scope">
                    <span>{{scope.row.xfCommission}}</span>
                  </template>
                </el-table-column>
                <!-- 	<el-table-column align="center" label="是否返佣">
								<template slot-scope="scope">
									<el-tag v-if="scope.row.isFy==0">是</el-tag>
                  <el-tag v-if="scope.row.isFy==1">否</el-tag>
								</template>
							</el-table-column> -->
                <el-table-column align="center" label="单据号">
                  <template slot-scope="scope">
                    <a type="text" @click="toAccounting(scope.row.sid,'1')">{{scope.row.agreementNo}}</a>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="是否每日记佣金">
                  <template slot-scope="scope">
                    <el-tag v-if="scope.row.isMrjy==1">是</el-tag>
                    <el-tag v-if="scope.row.isMrjy==0">否</el-tag>
                  </template>
                </el-table-column>
                <!-- <el-table-column align="center" label="备注">
								<template slot-scope="scope">
									<span>{{scope.row.remake}}</span>
								</template>
							</el-table-column> -->
                <!-- 							<el-table-column align="center" label="状态">
								<template slot-scope="scope">
								<el-tag v-if="scope.row.status==1">未返</el-tag>
								<el-tag v-if="scope.row.status==2">已返</el-tag>
								</template>
							</el-table-column> -->
                <el-table-column align="center" label="创建时间">
                  <template slot-scope="scope">
                    <span>{{scope.row.createDate}}</span>
                  </template>
                </el-table-column>
                <!-- <el-table-column align="center" fixed="right" label="操作">
						       <template slot-scope="scope">
						       	<el-button type="text" size="small" @click="showAgreement(scope.row.id,3)">修改</el-button>
						       	<el-button type="text" size="small" @click="deleteAgreement(scope.row.id,3)">删除</el-button>
						       </template>
						      </el-table-column> -->

              </el-table>
            </div>
            <div v-if="indexs=='1'">
              <el-form :inline="true" :model="searchTAgreementCommissionzfForm" ref="searchTAgreementCommissionzfForm">

                <el-form-item label="记佣时间" prop="jyDate">
                  <el-date-picker v-model="searchTAgreementCommissionzfForm.jyDate" type="daterange" range-separator="至"
                    start-placeholder="开始日期" value-format="yyyy-MM-dd" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <!-- <el-form-item label="返佣状态" prop="status">
								<el-select v-model="searchTAgreementCommissionForm.status" clearable  placeholder="请选择">
									<el-option v-for="item in optionsstatus" :key="item.value" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item> -->
                <el-form-item>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="commissionzffsFilter()">查询</el-button>
                  <!--  	<el-button v-if="isAuth('hotel:agreement:save')" type="danger" @click="showAgreement('',3)">新增</el-button> -->
                </el-form-item>
                <!--              <el-form-item>
              	<el-button size="small" type="primary" icon="el-icon-coin" @click="fanyong()">返佣</el-button> -->
                <!--  	<el-button v-if="isAuth('hotel:agreement:save')" type="danger" @click="showAgreement('',3)">新增</el-button> -->
                <!-- </el-form-item> -->
              </el-form>


              <el-table @sort-change="selectionChangeHandle" :data="dataList" @select="selecttables" @select-all="selectalls"
                v-loading="dataListLoading" element-loading-text="加载中...">
                <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
                <!-- <el-table-column align="center" label="房间号">
								<template slot-scope="scope">
									<span>{{scope.row.name}}</span>
								</template>
							</el-table-column> -->
                <el-table-column align="center" label="反佣时间">
                  <template slot-scope="scope">
                    <span>{{scope.row.creatTime}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="总金额">
                  <template slot-scope="scope">
                    <span>{{scope.row.summoney}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="已付金额">
                  <template slot-scope="scope">
                    <span>{{scope.row.yfmoney}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="支付详情">
                  <template slot-scope="scope">
                    <el-button type="primary" @click="commissionzf(scope.row.id)">支付详情</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="返佣详情">
                  <template slot-scope="scope">
                    <el-button type="primary" @click="commissionfy(scope.row.id)">返佣详情</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>

          <div v-if="tablekey=='4'">
            <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
              <el-tab-pane label="预收款明细" name="first"></el-tab-pane>
              <el-tab-pane label="已结算明细" name="second"></el-tab-pane>
              <el-tab-pane label="未结算明细" name="third"></el-tab-pane>
            </el-tabs>
            <div v-if="index=='0'">
              <el-form :inline="true" :model="searchyskForm" ref="searchyskForm">

                <el-form-item label="收/退款" prop="type">
                  <el-select v-model="searchyskForm.type" clearable placeholder="请选择">
                    <el-option v-for="item in sktype" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="getysklist()">查询</el-button>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="sk()">收款</el-button>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="tk()">退款</el-button>
                  <el-button size="small" type="primary" icon="el-icon-search">打印</el-button>
                </el-form-item>
              </el-form>
              <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
                style="width: 100%;">
                <el-table-column type="selection" header-align="center" align="center" width="50">
                </el-table-column>
                <el-table-column prop="creatTime" header-align="center" align="center" label="发生时间">
                </el-table-column>
                <el-table-column prop="banksNumber" header-align="center" align="center" label="账号">
                </el-table-column>
                <el-table-column prop="customerName" header-align="center" align="center" label="客户名称">
                </el-table-column>
                <el-table-column prop="nowTypeName" header-align="center" align="center" label="支付方式">

                </el-table-column>
                <el-table-column prop="payName" header-align="center" align="center" label="类型">
                </el-table-column>
                <el-table-column prop="payPrice" header-align="center" align="center" label="金额">
                </el-table-column>
                <el-table-column prop="collectionNo" header-align="center" align="center" label="收款单据号">
                </el-table-column>
                <el-table-column prop="refundNo" header-align="center" align="center" label="退款单据号">
                </el-table-column>
                <el-table-column prop="remarks" header-align="center" align="center" label="备注">
                </el-table-column>
                <!--      <el-table-column
                         prop="createUserId"
                         header-align="center"
                         align="center"
                         label="操作人">
                       </el-table-column>
                       <el-table-column
                         prop="updateData"
                         header-align="center"
                         align="center"
                         label="更新时间"> -->

              </el-table>
            </div>
            <div v-if="index=='1'">
              <el-form :inline="true" :model="searchyjsForm" ref="searchyskForm">
                <el-form-item label="发生时间" prop="jyDate">
                  <el-date-picker v-model="searchyjsForm.jyDate" type="daterange" range-separator="至" start-placeholder="开始日期"
                    value-format="yyyy-MM-dd" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="getsettlementList()">查询</el-button>
                  <el-button size="small" type="primary" icon="el-icon-printer" @click="dayin1()">打印</el-button>
                  <!--   <el-button size="small" type="primary" icon="el-icon-search" @click="getsettlementList()">刷新</el-button> -->
                </el-form-item>
              </el-form>
              <el-table @sort-change="selectionChangeHandle" :data="dataList" v-loading="dataListLoading"
                element-loading-text="加载中...">
                <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
                <el-table-column align="center" label="发生时间">
                  <template slot-scope="scope">
                    <span>{{scope.row.creatTime}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="账号">
                  <template slot-scope="scope">
                    <span>{{scope.row.agreementNo}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="客户名称">
                  <template slot-scope="scope">
                    <span>{{scope.row.customerName}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="金额">
                  <template slot-scope="scope">
                    <span>{{scope.row.receiptsMoney}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="支付详情">
                  <template slot-scope="scope">
                    <!-- 	<span>{{scope.row.checkDay}}</span> -->
                    <el-button type="primary" @click="zhifu(scope.row.id)">支付详情</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="明细详情">
                  <template slot-scope="scope">
                    <el-button type="primary" @click="mingxi(scope.row.id)">明细详情</el-button>
                    <!-- <span>{{scope.row.guestName}}</span> -->
                  </template>
                </el-table-column>

              </el-table>

            </div>
            <div v-if="index=='2'">
              <el-form :inline="true" :model="searchwskForm" ref="searchyskForm">
                <el-form-item label="发生时间" prop="jyDate">
                  <el-date-picker v-model="searchwskForm.jyDate" type="daterange" range-separator="至" start-placeholder="开始日期"
                    value-format="yyyy-MM-dd" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="getlistRzlist()">查询</el-button>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="showsettlementxs()">结算</el-button>
                  <el-button size="small" type="primary" icon="el-icon-search" @click="rz()">入账</el-button>
                  <el-button size="small" type="primary" @click="showZz()">转账</el-button>
                  <!-- 	<el-button size="small" type="primary" icon="el-icon-search">红冲费用</el-button> -->
                  <el-button size="small" type="primary" icon="el-icon-search" @click="getlistRzlist()">刷新</el-button>
                  <el-button size="small" type="primary" icon="el-icon-printer" @click="dayin()">打印</el-button>
                </el-form-item>
              </el-form>
              <el-table @sort-change="selectionChangeHandle" :data="dataList" v-loading="dataListLoading"
                element-loading-text="加载中..." @select="selecttable" @select-all="selectall">
                <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
                <el-table-column align="center" label="发生时间">
                  <template slot-scope="scope">
                    <span>{{scope.row.creatTime}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="账号" width="200">
                  <template slot-scope="scope">
                    <a type="text" v-if="scope.row.sid" @click="toAccounting(scope.row.sid,'1')">{{scope.row.banksNumber}}</a>
                    <a type="text" v-else>{{scope.row.banksNumber}}</a>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="项目名称">
                  <template slot-scope="scope">
                    <el-tag v-if="scope.row.roomSignNum!=''">{{scope.row.cname}}</el-tag>
                    <el-button type="primary" v-else @click="getconsume(scope.row.id)">{{scope.row.cname}}</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="客户名称">
                  <template slot-scope="scope">
                    <el-tag>{{scope.row.customerName}}</el-tag>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="房间号">
                  <template slot-scope="scope">
                    <sapn>{{scope.row.roomSignNum}}</sapn>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="金额">
                  <template slot-scope="scope">
                    <span>{{scope.row.payPrice}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="冲账金额">
                  <template slot-scope="scope">
                    <span>{{scope.row.hcMoney}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="剩余金额">
                  <template slot-scope="scope">
                    <span>{{scope.row.payPrice-scope.row.hcMoney}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="备注">
                  <template slot-scope="scope">
                    <span>{{scope.row.remarks}}</span>
                  </template>
                </el-table-column>
                <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
                  <template slot-scope="scope">
                    <el-button type="primary" @click="showHc(scope.row)">红冲</el-button>

                  </template>
                </el-table-column>

              </el-table>

            </div>
          </div>

          <div v-if="tablekey=='6'">
            <el-form :inline="true" :model="searchTAgreementCheckForm" ref="searchTAgreementCheckForm">
              <el-form-item label="日期" prop="jyDate">
                <el-date-picker v-model="searchTAgreementCheckForm.jyDate" type="daterange" range-separator="至"
                  start-placeholder="入住开始时间" value-format="yyyy-MM-dd" end-placeholder="入住结束时间">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="房间号" prop="status">
                <el-input v-model="searchTAgreementCheckForm.roomNumber" placeholder="房间号" clearable></el-input>
              </el-form-item>
              <el-form-item label="客人姓名" prop="status">
                <el-input v-model="searchTAgreementCheckForm.guestName" placeholder="客人姓名" clearable></el-input>
              </el-form-item>
              <el-form-item>
                <el-button size="small" type="primary" icon="el-icon-search" @click="checkFilter()">查询</el-button>
              </el-form-item>
            </el-form>
            <el-table @sort-change="selectionChangeHandle" :data="dataList" v-loading="dataListLoading"
              element-loading-text="加载中...">
              <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
              <el-table-column align="center" label="登记单号">
                <template slot-scope="scope">
                  <span>{{scope.row.ruzhu_no}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="房间号">
                <template slot-scope="scope">
                  <span>{{scope.row.room_sign_num}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="房价">
                <template slot-scope="scope">
                  <span>{{scope.row.oprice}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="入住时间">
                <template slot-scope="scope">
                  <span>{{scope.row.creat_time}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="离店时间">
                <template slot-scope="scope">
                  <span>{{scope.row.check_out_time}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="入住天数">
                <template slot-scope="scope">
                  <span>{{scope.row.days}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="客人姓名">
                <template slot-scope="scope">
                  <span>{{scope.row.panme}}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="房费">
                <template slot-scope="scope">
                  <span>{{scope.row.price}}</span>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
            :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
        </el-main>
      </el-container>
    </el-container>

    <el-dialog width="50%" :title="textMap[dialogStatus]" :visible.sync="addAgreementVisible" v-if="addAgreementVisible"
      append-to-body>
      <adddetailscustomer :mainid="mainid" :cancelReturn="cancelReturn" :id="id" :agreementNo="agreementNo"
        :customerJcName="customerJcName"></adddetailscustomer>
    </el-dialog>



    <el-dialog width="50%" title="详情" :visible.sync="showmingxi" v-if="showmingxi" append-to-body>
      <el-table :data="arraylist" v-loading="dataListLoading" style="width: 100%;">
        <el-table-column align="center" label="项目名称">
          <template slot-scope="scope">
            <el-button type="primary" v-if="scope.row.roomSignNum==''" @click="getconsume(scope.row.id)">{{scope.row.consumeName}}</el-button>
            <el-tag v-if="scope.row.roomSignNum!=''">{{scope.row.consumeName}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="center" label="单号">
          <template slot-scope="scope">
            <a type="text" v-if="scope.row.ruSysNo!=''" @click="toAccounting(scope.row.sid,'1')">{{scope.row.ruSysNo}}</a>
            <a type="text" v-if="scope.row.ruSysNo==''">{{scope.row.ruSysNo}}</a>
          </template>
        </el-table-column>
        <el-table-column align="center" label="房间号">
          <template slot-scope="scope">
            <span>{{scope.row.roomSignNum}}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="客户名称">
          <template slot-scope="scope">
            <el-tag>{{customerName}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="center" label="总金额">
          <template slot-scope="scope">
            <span>{{scope.row.payPrice}}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="红冲金额">
          <template slot-scope="scope">
            <span>{{scope.row.hcMoney}}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="剩余金额">
          <template slot-scope="scope">
            <span>{{scope.row.surplusMoney}}</span>
          </template>
        </el-table-column>

        <el-table-column align="center" label="备注">
          <template slot-scope="scope">
            <span>{{scope.row.remarks}}</span>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>


    <el-dialog width="50%" :title="textMap[dialogStatus]" :visible.sync="addContactsVisible" v-if="addContactsVisible"
      append-to-body>
      <addContacts :mainid="mainid" :cancelReturn="cancelReturn" :id="id" :agreementNo="agreementNo" :customerJcName="customerJcName"></addContacts>
    </el-dialog>

    <el-dialog width="70%" title="协议房价列表" :visible.sync="showagreedrate" v-if="showagreedrate" append-to-body>
      <addagreedrates :mainid="mainid" :cancelReturn="cancelReturnagrdddrate" :item="item"></addagreedrates>
    </el-dialog>


    <el-dialog width="50%" :title="textMap[dialogStatus]" :visible.sync="addyskVisible" v-if="addyskVisible"
      append-to-body>
      <yskaddd :mainid="mainid" :cancelReturn="cancelReturn" :id="id" :agreementNo="agreementNo" :customerJcName="customerJcName"
        :sktype='sktypeid' :customerName="customerName"></yskaddd>
    </el-dialog>

    <el-dialog width="50%" title="详细信息" :visible.sync="getxxxx" v-if="getxxxx" append-to-body>
      <el-table :data="consumelist" style="width: 100%">
        <el-table-column prop="name" label="名称">
        </el-table-column>
        <el-table-column prop="shouomoney" label="单价">
        </el-table-column>
        <el-table-column prop="number" label="数量">
        </el-table-column>
        <el-table-column prop="summoney" label="总价">
        </el-table-column>
        <el-table-column prop="remakes" label="备注">
        </el-table-column>

      </el-table>
    </el-dialog>


    <el-dialog width="50%" title="支付详情" :visible.sync="showzhifu" v-if="showzhifu" append-to-body>
      <el-table :data="arraylist" v-loading="dataListLoading" style="width: 100%;">
        <el-table-column prop="shopName" header-align="center" align="center" label="支付方式"></el-table-column>
        <el-table-column prop="money" header-align="center" align="center" label="金额"></el-table-column>
      </el-table>
    </el-dialog>

    <el-dialog width="50%" title="返佣详情" :visible.sync="showcommission" v-if="showcommission" append-to-body>
      <el-table :data="commissionlist" v-loading="dataListLoading" style="width: 100%;">
        <el-table-column align="center" label="房间号">
          <template slot-scope="scope">
            <span>{{scope.row.name}}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="记佣时间">
          <template slot-scope="scope">
            <span>{{scope.row.jyDate}}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="需返佣金">
          <template slot-scope="scope">
            <span>{{scope.row.xfCommission}}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="单据号">
          <template slot-scope="scope">
            <a type="text" @click="toAccounting(scope.row.sid,'1')">{{scope.row.agreementNo}}</a>
          </template>
        </el-table-column>
        <el-table-column align="center" label="是否每日记佣金">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.isMrjy==1">是</el-tag>
            <el-tag v-if="scope.row.isMrjy==0">否</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="center" label="创建时间">
          <template slot-scope="scope">
            <span>{{scope.row.createDate}}</span>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <el-dialog width="50%" title="充值" :visible.sync="showHcxs" v-if="showHcxs" append-to-body>
      <el-form ref="dataForm" :model="dataForm1" label-width="80px">
        <el-form-item label="充值金额">
          <el-input type="number" v-model="dataForm1.hcMoney" min="0" @change="changHcxs(dataForm1.hcMoney)"></el-input>
        </el-form-item>
        <el-form-item label="冲账原因">
          <el-input type="textarea" :rows="2" placeholder="请输入冲账原因" v-model="dataForm1.accountyy">
          </el-input>
        </el-form-item>

      </el-form>
      <span class="dialog-footer">
        <el-button @click="showHcxs = false">取消</el-button>
        <el-button type="primary" @click="updateYsk()">保存</el-button>
      </span>
    </el-dialog>


    <el-dialog width="50%" title="入账" :visible.sync="addrz" v-if="addrz" append-to-body>
      <el-row>
        <el-col :span="inputPriceFlag ? 7 : 24" >
          <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
            <el-form-item size="small" label="入账账号">
              <el-input v-model="agreementNo" readonly></el-input>
            </el-form-item>
            <el-form-item size="small" label="消费类目" style="margin-bottom: 0px;">
              <el-select v-model="dataForm.consumeId" @change="consumeChange" placeholder="请选择">
                <el-option v-for="item in dataList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>

            <el-form-item size="small" :style="dataList.filter(item=>item.isQuick == 1).length == 0 ? '' : 'margin-bottom: 2px;'">
              <el-link style="margin-right: 5px;" v-for="item in dataList.filter(item=>item.isQuick == 1)" :key="item.id"
                @click="linkClick(item)" type="primary">{{item.name}}</el-link>
            </el-form-item>

            <el-form-item label="消费金额" prop="payPrice">
              <el-input v-model="dataForm.payPrice" :disabled="inputPriceFlag" placeholder="金额"></el-input>
            </el-form-item>


            <el-form-item label="付款金额" v-if="fukuan == 1" prop="payPrice">
              <span>{{ dataForm.payPrice }}</span>
            </el-form-item>

            <el-form-item label="备注" prop="remarks">
              <el-input type="textarea" :rows="2" v-model="dataForm.remarks" placeholder="备注"></el-input>
            </el-form-item>
          </el-form>

        </el-col>
        <el-col :span="17" style="padding-left: 6px;" v-if="inputPriceFlag">
          <el-form :inline="true" :model="dataForm">
            <el-form-item>
              <el-select v-model="dataForm.consumeId2" @change="getShopDataList" placeholder="类别" clearable>
                <el-option v-for="item in consumeEntities" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-input v-model="dataForm.key" placeholder="名称" clearable></el-input>
            </el-form-item>
            <el-form-item>
              <el-button icon="el-icon-search" circle @click="getShopDataList"></el-button>
            </el-form-item>
          </el-form>
          <el-table :data="shopDataList" v-loading="dataListLoading" style="width: 100%;">
            <el-table-column prop="shopName" header-align="center" align="center" label="名称"></el-table-column>
            <el-table-column prop="salePrice" header-align="center" align="center" label="售价">
              <template slot-scope="scope">
                <el-input-number size="mini" @change="shopChange(scope.row)" v-model="scope.row.salePrice" :precision="2"
                  :step="1" :min="0"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column prop="count" header-align="center" align="center" label="数量">
              <template slot-scope="scope">
                <el-input-number size="mini" @change="shopChange(scope.row)" v-model="scope.row.count" :step="1" :min="0"
                  :max="scope.row.stockNum"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column prop="stockNum" header-align="center" align="center" label="剩余库存">
              <template slot-scope="scope">
                {{ scope.row.stockNum - scope.row.count }}
              </template>
            </el-table-column>
          </el-table>
          <el-pagination @size-change="sizeChangeHandlerz" @current-change="currentChangeHandlerz" :current-page="pageIndexrz"
            :page-sizes="[10, 20, 50, 100]" :page-size="pageSizerz" :total="totalPagerz" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
        </el-col>
      </el-row>
      <span class="dialog-footer">
        <el-button @click="addrz = false">取消</el-button>
        <el-button type="primary" @click="savesubmit(2)">保存</el-button>
      </span>
    </el-dialog>

    <el-dialog width="50%" title="转账" :visible.sync="showFormZz" v-if="showFormZz" append-to-body>
      <el-form :inline="true" :model="agreementdataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="agreementdataForm.customerName" placeholder="客户名称" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getAgreementDataList()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table :data="agreementdataList" border="" v-loading="dataListLoading" @selection-change="selectionChangeHandle"
        style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="120"></el-table-column>
        <el-table-column prop="accountNo" header-align="center" align="center" label="账号"></el-table-column>
        <el-table-column prop="customerNo" header-align="center" align="center" label="客户编号"></el-table-column>
        <el-table-column prop="customerName" header-align="center" align="center" label="客户名称"></el-table-column>
        <!-- <el-table-column prop="status" header-align="center" align="center" label="客户状态"></el-table-column>
					<el-table-column prop="customerType" header-align="center" align="center" label="客户类型"></el-table-column>
					<el-table-column prop="customerIndustry" header-align="center" align="center" label="客户行业"></el-table-column>
					<el-table-column prop="contacts" header-align="center" align="center" label="联系人"></el-table-column>
					<el-table-column prop="phone" header-align="center" align="center" label="联系电话"></el-table-column>
					<el-table-column prop="companyPhone" header-align="center" align="center" label="公司电话"></el-table-column>
					<el-table-column prop="fax" header-align="center" align="center" label="传真"></el-table-column>
					<el-table-column prop="region" header-align="center" align="center" label="地区"></el-table-column>
					<el-table-column prop="email" header-align="center" align="center" label="Email"></el-table-column> -->
        <el-table-column prop="updateTime" header-align="center" align="center" label="审核时间"></el-table-column>


        <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="ZZ(scope.row)">确认转账</el-button>
          </template>
        </el-table-column>
      </el-table>

    </el-dialog>


    <el-dialog width="33%" title="结算" :visible.sync="showsettlement" v-if="showsettlement" append-to-body>
      <el-form ref="settlement" :model="settlement" :inline="true" label-width="80px">
        <el-form-item label="账号">
          <el-input v-model="settlement.agreementNo" readonly></el-input>
        </el-form-item>
        <el-form-item label="客户姓名">
          <el-input v-model="settlement.customerName" readonly></el-input>
        </el-form-item>

        <el-form-item label="应收金额">
          <el-input v-model="settlement.receivableMoney" readonly></el-input>
        </el-form-item>
        <el-form-item label="实收金额">
          <el-input v-model="settlement.receiptsMoney" readonly></el-input>
        </el-form-item>
        <div v-for="(item, indexs) in settlement.nowpays" :key="indexs" style="margin-left: 80px;">
          <el-form-item size="small" class="in_block" label-width="0">
            <el-select v-model="item.nowType" placeholder="请选择" @change="selectnowtype(item.nowType,indexs)">
              <el-option v-for="item in zftypelist" :key="item.name" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item size="small" class="in_block" label-width="10px">
            <el-input @change="yunowpaysChange" v-model="item.payPrice" placeholder="￥ 0.00"></el-input>
          </el-form-item>
          <el-button size="small" class="in_block" v-if="indexs != 0" @click="remPaysItem(item)">删除</el-button>
          <el-button size="small" class="in_block" v-if="indexs == 0" @click="addPaysItem">添加收款</el-button>
        </div>
        <div class="el-dialog__footer">
          <div slot="footer" class="dialog-footer">
            <el-button @click="showsettlement=false">取 消</el-button>
            <el-button type="primary" @click="savesettlement()">保 存</el-button>
          </div>
        </div>
      </el-form>
    </el-dialog>


    <el-dialog width="33%" title="返佣" :visible.sync="showfanyong" v-if="showfanyong" append-to-body>
      <el-form ref="commission" :model="commission" :inline="true" label-width="80px">
        <el-form-item label="账号">
          <el-input v-model="commission.agreementNo" readonly></el-input>
        </el-form-item>
        <el-form-item label="客户姓名">
          <el-input v-model="commission.customerName" readonly></el-input>
        </el-form-item>

        <el-form-item label="应收金额">
          <el-input v-model="commission.summoney" readonly></el-input>
        </el-form-item>
        <el-form-item label="实收金额">
          <el-input v-model="commission.yfmoney" readonly></el-input>
        </el-form-item>
        <div v-for="(item, indexs) in commission.nowpays" :key="indexs" style="margin-left: 80px;">
          <el-form-item size="small" class="in_block" label-width="0">
            <el-select v-model="item.nowType" placeholder="请选择" @change="selectcommissiontype(item.nowType,indexs)">
              <el-option v-for="item in zftypelist" :key="item.name" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item size="small" class="in_block" label-width="10px">
            <el-input @change="yjwpaysChange" v-model="item.payPrice" placeholder="￥ 0.00"></el-input>
          </el-form-item>
          <el-button size="small" class="in_block" v-if="indexs != 0" @click="remPayscommission(item)">删除</el-button>
          <el-button size="small" class="in_block" v-if="indexs == 0" @click="addPaycommission">添加收款</el-button>
        </div>
        <div class="el-dialog__footer">
          <div slot="footer" class="dialog-footer">
            <el-button @click="showfanyong=false">取 消</el-button>
            <el-button type="primary" @click="savecommission()">保 存</el-button>
          </div>
        </div>
      </el-form>
    </el-dialog>


    <iframe id="print-iframe" style="display: none;"></iframe>


  </div>




</template>
<script>
  import adddetailscustomer from "./adddetailscustomer.vue";
  import yskaddd from "./tagreementyskpayment-add-or-update.vue";
  import addContacts from "./addcontacts.vue";
  import addagreedrates from "./addagreedrate.vue";
  import moment from 'moment';
  export default {
    components: {
      adddetailscustomer,
      addagreedrates,
      addContacts,
      yskaddd
    },
    props: {
      mainid: {
        type: String
      },
      agreementNo: {
        type: String
      },
      customerJcName: {
        type: String
      },
      returnAgreemDetails: {
        type: Function
      },
      customerName: {
        type: String
      }
    },
    data() {
      return {
        inputPriceFlag: true,
        floorroomconsumelists: [],
        dataForm1: {
          accountyy: '',
          hcMoney: 0,
          id: '',
        },
        item: {},
        agreementdataList: [],
        agreementdataForm: {
          customerName: '',
          id: ''
        },
        countnum: 0,
        settlement: {
          nowpays: [{
            nowType: '',
            payPrice: '',
            state: 2
          }],
          seletelist: [],
          customerName: '',
          agreementNo: '',
          receivableMoney: 0,
          receiptsMoney: 0,
          agreementId: ''

        },
        selectedColumn: {
          '发生时间': true,
          '账号': true,
          '项目名称': true,
          '客户名称': true,
          '房间号': true,
          '金额': true,
          '冲账金额': true,
          '剩余金额': true,
          '备注': true,

        },
        selectedColumns: {
          '发生时间': true,
          '账号': true,
          '客户名称': true,
          '金额': true,
        },
        searchwskForm: {},
        tableHeaders: [
          {
            name: '发生时间',
            field: 'creatTime'
          },
          {
            name: '账号',
            field: 'banksNumber'
          },
          {
            name: '客户名称',
            field: 'customerName'
          },
          {
            name: '金额',
            field: 'payPrice'
          }
        ],
        tableHeader: [
          {
            name: '发生时间',
            field: 'creatTime'
          },
          {
            name: '账号',
            field: 'banksNumber'
          },
          {
            name: '项目名称',
            field: 'cname'
          },
          {
            name: '客户名称',
            field: 'customerName'
          },
          {
            name: '房间号',
            field: 'roomSignNum'
          },
          {
            name: '金额',
            field: 'payPrice'
          },
          {
            name: '冲账金额',
            field: 'hcMoney'
          },
          {
            name: '剩余金额',
            field: 'symoney'
          },
          {
            name: '备注',
            field: 'remarks'
          }
        ],
        summoney: 0,
        sumhcmoney: 0,
        sumsymoney: 0,
        indexs: '0',
        commission: {
          nowpays: [{
            nowType: '',
            payPrice: '',
            state: 2
          }],
          seletelist: [],
          customerName: '',
          agreementNo: '',
          summoney: 0,
          yfmoney: 0,
          agreementId: ''
        },
        pageIndexrz: 1,
        pageSizerz: 10,
        totalPagerz: 0,
        fukuan: 2,
        dataLists: [],
        dataRule: {
          sellerId: [{
            required: true,
            message: '商家不能为空',
            trigger: 'blur'
          }]
        },
        addyskVisible: false,
        getxxxx: false,
        activeName: '',
        searchyskForm: {
          type: ''
        },
        showsettlement: false,
        sktype: [
          {
          name: '收款',
          id: '0'
        }, {
          name: '退款',
          id: '5'
        }],
        paysActiveName: 'first',
        optionsstatus: [
          {
          value: 1,
          label: '未返'
        }, {
          value: 2,
          label: '已返'
        }],
        searchTAgreementCheckForm: {
          jyDate: '',
          guestName: '',
          roomNumber: ''
        },
        addrz: false,
        searchTAgreementContactsForm: {},
        showagreedrate: false,
        agreementFrom: {
          name: undefined,
          limit: undefined,
          page: undefined,
          agreementId: undefined
        },
        textMap: {
          update: '编辑',
          create: '创建'
        },
        searchTAgreementCommissionForm: {
          jyDate: '',
          status: ''
        },
        searchyjsForm: {},
        payInterfaceConfig: {}, //支付
        selectlist: [],
        selectlists: [],
        dataForm: {
          sellerId: '',
          conids: '',
          consumeId: '',
          consumeId2: '',
          payType: '',
          creatTime: '',
          payPrice: 0,
          banks: '',
          banksNumber: '',
          referenceNumber: '',
          termValidity: '',
          peopleId: '',
          remarks: '',
          nowType: '',
          list: [],
          accountyy: '',
          hcMoney: 0,
          type: '',
          customerName: '',
          consumelist: '-1',
          surplusMoney: 0

        },
        options: {
          paysTypeOptions: [],
          peopleOptions: []
        },
        searchTAgreementCommissionzfForm: {},
        searchlistRzForm: {},
        commissionlist: [],
        showcommission: false,
        sktypeid: '',
        addContactsVisible: false,
        isCollapse: true,
        tablekey: 1,
        dataList: [],
        showmingxi: false,
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false,
        dataListSelections: [],
        dialogStatus: 'create',
        index: '0',
        id: undefined,
        consumelist: [],
        zftypelist: [],
        consumeEntities: [],
        shopDataList: [],
        addAgreementVisible: false,
        authPrice: '',
        yunowpays: '',
        arraylist: [],
        showzhifu: false,
        showHcxs: false, //显示充值
        showFormZz: false,
        showfanyong: false

      };
    },
    created() {
      this.getDataAgreementList();
      this.getAggreementList();
      this.getPayInterface();
    },
    methods: {

      linkClick(item) {
        this.dataForm.consumeId = item.id
        this.consumeChange()
      },
      returncommission() {
        this.commission = {
          nowpays: [{
            nowType: '',
            payPrice: '',
            state: 2
          }],
          seletelist: [],
          customerName: '',
          agreementNo: '',
          summoney: 0,
          yfmoney: 0,
          agreementId: ''

        }
      },

      consumeChange() {
        this.dataForm.consumeId2 = '';
        this.shopDataList = []
        //请求旗下分类
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomconsume/subsetList'),
          method: 'get',
          params: this.$http.adornParams({
            parentId: this.dataForm.consumeId,
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.consumeEntities = data.consumeEntities
            if (data.consumeEntities.length > 0) {
              this.inputPriceFlag = true;
            } else {
              this.inputPriceFlag = false;
            }
          }
        });
        this.getShopDataList();
      },
      fanyong() {
        if (this.selectlists.length == 0) {
          this.$message({
            showClose: true,
            message: '请选择数据',
            type: 'error'
          });
          return false;
        }
        this.returncommission();
        this.commission.customerName = this.customerName;
        this.commission.agreementNo = this.agreementNo;
        var money = 0;
        for (var i = 0; i < this.selectlists.length; i++) {
          var demo = this.selectlists[i];
          money = parseFloat(money) + parseFloat(demo.xfCommission);
        }
        this.commission.summoney = money;
        this.showfanyong = true;
      },
      toAccounting(sid, type) {

        this.showmingxi = false;
        //将数据存储到本地
        var p = {
          singleId: sid,
          type: type,
        }
        this.$cookie.set("accounting", JSON.stringify(p));
        this.$router.push({
          name: 'accounting'
        })

        this.returnAgreemDetails();
      },
      ZZ(row) {
        var demo = {};
        demo["selectList"] = this.selectlist;
        demo["id"] = row.id;
        demo["banksNumber"] = row.accountNo;
        demo["customerName"] = row.customerName;
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomcheckinaccounting/updateAgreementByid'),
          method: 'post',
          data: demo
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.$message({
              message: "转账成功",
              type: "success",
              duration: 1500,
              onClose: () => {
                this.getlistRzlist();
                this.showFormZz = false;
              }
            });
          }
        });

      },
      getAgreementDataList() {
        this.dataListLoading = true;
        this.agreementdataForm.id = this.mainid;
        this.$http({
          url: this.$http.adornUrl("/hotel/agreement/listArray"),
          method: "get",
          params: this.agreementdataForm
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

            this.agreementdataList = data.page;
          } else {
            this.agreementdataList = [];
          }
          this.dataListLoading = false;
        });
      },
      showZz() {
        if (this.selectlist.length != 0) {
          this.showFormZz = true;
        } else {
          this.$message({
            showClose: true,
            message: '请选择数据',
            type: 'error'
          });
        }

      },
      changHcxs(money) {
        if (money > this.dataForm.payPrice) {
          this.dataForm.hcMoney = 0;
          this.$message({
            showClose: true,
            message: '不能大于全部金额',
            type: 'error'
          });
        }
      },
      showHc(row) {
        this.dataForm = row;
        this.dataForm1.id = row.id;
        this.dataForm1.hcMoney = '';
        this.dataForm1.accountyy = '';
        this.showHcxs = true;
      },
      commissionfy(id) {
        this.$http({
          url: this.$http.adornUrl('/hotel/agreement-commission/listArray'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            yfId: id
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.commissionlist = data.page;
            this.showcommission = true;
          } else {
            this.commissionlist = [];
          }
        });

      },
      zhifu(id) {
        this.$http({
          url: this.$http.adornUrl('/hotel/tagreementsettlementzfxq/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            settlementId: id
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

            this.arraylist = data.page.list;
            this.showzhifu = true;
          } else {
            this.arraylist = [];
          }
        });

      },

      commissionzf(id) {
        this.$http({
          url: this.$http.adornUrl('/hotel/tagreementcommissionzfxq/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            id: id
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.arraylist = data.page;
            this.showzhifu = true;
          } else {
            this.arraylist = [];
          }
        });

      },
      mingxi(id) {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomcheckinaccounting/listmx'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            id: id
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

            this.arraylist = data.page;
            this.showmingxi = true;
          } else {
            this.arraylist = [];
          }
        });

      },
      updateYsk() {

        if (this.dataForm1.hcMoney != "" && this.dataForm1.hcMoney != 0) {
          this.dataForm.surplusMoney = this.dataForm.payPrice - this.dataForm1.hcMoney;
          this.$http({
            url: this.$http.adornUrl('/hotel/thotelfloorroomcheckinaccounting/updateByhc'),
            method: 'post',
            data: this.dataForm1
          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500,
                onClose: () => {
                  this.getlistRzlist();
                  this.showHcxs = false
                }
              });
            } else {
              this.$message({
                message: data.msg,
                type: "error",

              });
            }
          });
        }
      },
      savesettlement() {
        if (this.settlement.receiptsMoney != this.settlement.receivableMoney) {
          this.$message({
            showClose: true,
            message: '应付金额必须等于应收金额',
            type: 'error'
          });
          return false;
        }
        if (this.settlement.nowpays[0].nowType == "") {
          this.$message({
            showClose: true,
            message: '请选择支付方式',
            type: 'error'
          });
          return false;
        }
        this.settlement.agreementId = this.mainid;
        this.settlement.seletelist = this.selectlist;
        this.$http({
          url: this.$http.adornUrl(
            `/hotel/tagreementsettlement/save`
          ),
          method: "post",
          data: this.settlement
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500,
              onClose: () => {
                this.getlistRzlist();
                this.showsettlement = false
              }
            });
          } else {
            this.$message.error(data.msg);
          }
        });

      },

      savecommission() {
        if (this.commission.receiptsMoney != this.commission.receivableMoney) {
          this.$message({
            showClose: true,
            message: '应付金额必须等于应收金额',
            type: 'error'
          });
          return false;
        }
        if (this.commission.nowpays[0].nowType == "") {
          this.$message({
            showClose: true,
            message: '请选择支付方式',
            type: 'error'
          });
          return false;
        }
        this.commission.agreementId = this.mainid;
        this.commission.seletelist = this.selectlists;
        this.$http({
          url: this.$http.adornUrl(
            `/hotel/tagreementcommissionyfjl/save`
          ),
          method: "post",
          data: this.commission
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500,
              onClose: () => {
                this.commissionhandleFilter("1");
                this.showfanyong = false
              }
            });
          } else {
            this.$message.error(data.msg);
          }
        });

      },

      selectnowtype(type, index) {
        console.log(this.settlement.nowpays.length)
        if (this.settlement.nowpays.length != 0) {
          for (var i = 0; i < index; i++) {
            var demo = this.settlement.nowpays[i];
            var nowType = demo.nowType;
            if (nowType == type) {
              this.$message({
                showClose: true,
                message: '已有该类型',
                type: 'error'
              });
              this.settlement.nowpays[index].nowType = "";
            }
          }
        }

      },
      selectcommissiontype(type, index) {
        console.log(this.settlement.nowpays.length)
        if (this.commission.nowpays.length != 0) {
          for (var i = 0; i < index; i++) {
            var demo = this.commission.nowpays[i];
            var nowType = demo.nowType;
            if (nowType == type) {
              this.$message({
                showClose: true,
                message: '已有该类型',
                type: 'error'
              });
              this.commission.nowpays[index].nowType = "";
            }
          }
        }

      },
      addPaysItem() {
        this.settlement.nowpays.push({
          nowType: '',
          payPrice: '',
          state: 2
        });
      },
      addPaycommission() {
        this.commission.nowpays.push({
          nowType: '',
          payPrice: '',
          state: 2
        });
      },
      showsettlementxs() {

        if (this.selectlist.length == 0) {
          this.$message({
            showClose: true,
            message: '请选择数据',
            type: 'error'
          });
          return false;
        }
        this.returnsettlement();
        this.settlement.customerName = this.customerName;
        this.settlement.agreementNo = this.agreementNo;
        var money = 0;
        for (var i = 0; i < this.selectlist.length; i++) {
          var demo = this.selectlist[i];

          var count = demo.payPrice - demo.hcMoney;

          money += count;
        }
        this.settlement.receivableMoney = money;
        this.showsettlement = true;
      },
      selectall(selection, row) {

        this.selectlist = selection;
      },
      selecttable(selection, row) {

        this.selectlist = selection;
      },
      selectalls(selection, row) {

        this.selectlists = selection;
      },
      selecttables(selection, row) {

        this.selectlists = selection;
      },

      returnsettlement() {
        this.settlement = {
          nowpays: [{
            nowType: '',
            payPrice: '',
            state: 2
          }],
          customerName: '',
          agreementNo: '',
          receivableMoney: 0,
          receiptsMoney: 0
        }
      },
      getconsume(id) {
        this.getconsumelist(id);
        this.getxxxx = true;
      },
      remPaysItem(item) {
        this.settlement.nowpays.splice(this.settlement.nowpays.indexOf(item), 1);
        this.yunowpaysChange();
      },
      remPayscommission(item) {
        this.commission.nowpays.splice(this.commission.nowpays.indexOf(item), 1);
        this.yjwpaysChange();
      },
      getconsumelist(id) {
        this.$http({
          url: this.$http.adornUrl('/hotel/tagreementcustomerjl/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            id: id
          })
        }).then(({
          data
        }) => {

          if (data && data.code === 0) {

            this.consumelist = data.page;
          } else {
            this.consumelist = [];
          }
        });

      },
      getPayInterface() {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelsellerpayinterfaceconfig/myInfo`),
          method: 'get'
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.payInterfaceConfig = data.tHotelSellerPayInterfaceConfig
          } else {
            this.$message.error("加载支付配置失败")
          }
        })
      },
      yunowpaysChange() {
        this.settlement.receiptsMoney = 0;
        this.settlement.nowpays.forEach(item => {
          this.settlement.receiptsMoney += parseFloat(item.payPrice ? item.payPrice : 0);
        });
      },
      yjwpaysChange() {
        this.commission.yfmoney = 0;
        this.commission.nowpays.forEach(item => {
          this.commission.yfmoney += parseFloat(item.payPrice ? item.payPrice : 0);
        });
      },
      //获取所有分类
      getDataList() {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomconsume/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            parentId: 0
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list;
            console.log(this.dataList);
          } else {
            this.dataList = [];
          }
        });
      },
      shopChange(row) {
        this.countnum = 0;
        var id = row.id;
        var l = 0;
        if (this.dataForm.list != undefined && this.dataForm.list.length != 0) {
          for (var i = 0; i < this.dataForm.list.length; i++) {
            var demo = this.dataForm.list[i];
            if (id == demo.id) {
              this.dataForm.list[i] = row;
              l = 1;
            }
            this.countnum += demo.count;
          }
          if (l == 0) {
            this.dataForm.list.push(row);
          }
        } else {
          this.dataForm.list.push(row);
        }
        //计算价格
        var money = 0;
        this.shopDataList.forEach(item => {
          var count = item.count;
          var salePrice = item.salePrice;

          money += count * salePrice;
        });
        this.dataForm.payPrice = money;
        this.dataForm.conids += row.parentId + ",";
      },
      getsettlementList() {
        var checkDate = '';
        var departureDate = '';
        if (this.searchyjsForm.jyDate != null) {
          checkDate = this.searchyjsForm.jyDate[0] + " 23:59:59";
          departureDate = this.searchyjsForm.jyDate[1] + " 23:59:59";
        } else {
          checkDate = '';
          departureDate = '';
        }
        this.dataListLoading = true;
        this.$http({
          url: this.$http.adornUrl("/hotel/tagreementsettlement/list"),
          method: "get",
          params: this.$http.adornParams({
            page: this.pageIndex,
            limit: this.pageSize,
            agreementId: this.mainid,
            checkDate: checkDate,
            departureDate: departureDate
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list;
            this.totalPage = data.page.totalCount;
            this.summoney = data.page.summoney;
            // this.pageIndex = data.page.page;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },


      //获取支付方式
      getPayTypes() {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroompaytype/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            isDeposit: 1,
            state: 1
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.options.paysTypeOptions = data.page.list;
            this.dataForm.nowType = this.options.paysTypeOptions[0].id;
          } else {
            this.options.paysTypeOptions = [];
          }
        });
      },
      //获取状态分组
      getAggreementList() {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroompaytype/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,

            isDeposit: 1,
            state: 1
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

            this.zftypelist = data.page.list;

          } else {
            this.zftypelist = [];
          }
        });
      },
      handleClick(tab, event) {
        this.pageIndex = 1;
        if (tab.index == 0) {
          this.getysklist();
        } else if (tab.index == 1) {
          this.getsettlementList();
        } else {
          this.getlistRzlist();
        }
        this.index = tab.index;
      },

      handleyjClick(tab, event) {
        this.pageIndex = 1;
        if (tab.index == 0) {
          this.commissionFilter("1");
        } else if (tab.index == 1) {
          this.commissionzffsFilter();
        } else {
          // this.getlistRzlist();
        }
        this.indexs = tab.index;
      },
      rz() {
        this.shopDataList = [];
        this.cz();
        this.getDataList();
        this.addrz = true;
      },
      // 每页数
      sizeChangeHandlerz(val) {
        this.pageSizerz = val;
        this.pageIndexrz = 1;
        this.getShopDataList();
      },
      // 当前页
      currentChangeHandlerz(val) {
        this.pageIndexrz = val;
        this.getShopDataList();
      },
      // 获取数据列表
      getShopDataList() {
        this.dataListLoading = true;
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomconsumeshop/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: this.pageIndex,
            limit: this.pageSize,
            parentId:this.dataForm.consumeId2 ? this.dataForm.consumeId2 : this.dataForm.consumeId,
            state: 1,
            key: this.dataForm.key
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.shopDataList = data.page.list.map(item => ({
              ...item,
              count: 0
            }));
              this.totalPagerz = data.page.totalCount;
          } else {
            this.shopDataList = [];
          }
          this.dataListLoading = false;
        });
      },
      sk() {
        this.sktypeid = '0';
        this.addyskVisible = true;
      },
      tk() {
        this.sktypeid = '5';
        this.addyskVisible = true;
      },

      getlistRzlist() {
        if (this.searchwskForm.jyDate != null) {
          this.searchlistRzForm.checkDate = this.searchwskForm.jyDate[0];
          this.searchlistRzForm.departureDate = this.searchwskForm.jyDate[1];
        } else {
          this.searchlistRzForm.checkDate = '';
          this.searchlistRzForm.departureDate = '';
        }
        this.selectlist = [];
        this.dataListLoading = true;
        this.searchlistRzForm.agreementId = this.mainid;
        this.searchlistRzForm.limit = this.pageSize;
        this.searchlistRzForm.page = this.pageIndex;
        this.$http({
          url: this.$http.adornUrl("/hotel/thotelfloorroomcheckinaccounting/listRz"),
          method: "get",
          params: this.$http.adornParams({
            page: this.pageIndex,
            limit: this.pageSize,
            ...this.searchlistRzForm
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

            this.dataList = data.page.list;
            this.totalPage = data.page.totalCount;
            this.summoney = data.page.summoney;
            this.sumhcmoney = data.page.sumhcmoney;
            this.sumsymoney = data.page.sumsymoney;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },
      cz() {
        this.dataForm = {
          sellerId: '',
          consumeId: '',
          conids: '',
          consumelist: '-1',
          payType: '',
          creatTime: '',
          payPrice: 0,
          banks: '',
          banksNumber: '',
          referenceNumber: '',
          termValidity: '',
          peopleId: '',
          remarks: '',
          nowType: '',
          list: [],
          type: '',
          customerName: '',
          agreementId: ''
        }
      },
      getysklist() {
        this.dataListLoading = true;
        this.searchyskForm.agreementId = this.mainid;
        this.searchyskForm.limit = this.pageSize;
        this.searchyskForm.page = this.pageIndex;
        this.$http({
          url: this.$http.adornUrl("/hotel/thotelfloorroomcheckinaccounting/listAgreement"),
          method: "get",
          params: this.$http.adornParams({
            page: this.pageIndex,
            limit: this.pageSize,
            ...this.searchyskForm
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list;
            this.totalPage = data.page.totalCount;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },
      checkFilter() {
        this.searchTAgreementCheckForm.page = 1;
        this.getAgreementCheckList();
      },

      contactsFilter() {
        this.searchTAgreementContactsForm.page = 1;
        this.getAgreementContactsList();
      },
      commissionFilter(val) {
        this.searchTAgreementCommissionForm.page = 1;
        this.commissionhandleFilter("1");
      },


      commissionzffsFilter() {
        if (this.searchTAgreementCommissionzfForm.jyDate != null) {
          this.searchTAgreementCommissionzfForm.checkDate = this.searchTAgreementCommissionzfForm.jyDate[0];
          this.searchTAgreementCommissionzfForm.departureDate = this.searchTAgreementCommissionzfForm.jyDate[1];
        }
        this.dataListLoading = true;
        this.searchTAgreementCommissionzfForm.agreementId = this.mainid;
        this.searchTAgreementCommissionzfForm.limit = this.pageSize;
        this.searchTAgreementCommissionzfForm.page = this.pageIndex;
        var jsonob = {};
        if (this.searchTAgreementCommissionzfForm.jyDate != null) {
          jsonob["checkDate"] = this.searchTAgreementCommissionzfForm.checkDate;
          jsonob["departureDate"] = this.searchTAgreementCommissionzfForm.departureDate;
        }
        jsonob["agreementId"] = this.mainid;
        jsonob["limit"] = this.pageSize;
        jsonob["page"] = this.pageIndex;
        this.$http({
          url: this.$http.adornUrl("/hotel/tagreementcommissionyfjl/list"),
          method: "get",
          params: this.$http.adornParams({
            ...jsonob
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

            this.dataList = data.page.list;
            this.totalPage = data.page.sum;
            this.pageIndex = data.page.page;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },

      commissionhandleFilter(val) {
        if (this.searchTAgreementCommissionForm.jyDate != null) {
          this.searchTAgreementCommissionForm.checkDate = this.searchTAgreementCommissionForm.jyDate[0];
          this.searchTAgreementCommissionForm.departureDate = this.searchTAgreementCommissionForm.jyDate[1];
        }
        this.dataListLoading = true;
        this.searchTAgreementCommissionForm.agreementId = this.mainid;
        this.searchTAgreementCommissionForm.limit = this.pageSize;
        this.searchTAgreementCommissionForm.page = this.pageIndex;
        var jsonob = {};
        if (this.searchTAgreementCommissionForm.jyDate != null) {
          jsonob["checkDate"] = this.searchTAgreementCommissionForm.checkDate;
          jsonob["departureDate"] = this.searchTAgreementCommissionForm.departureDate;
        }
        jsonob["status"] = val;
        jsonob["agreementId"] = this.mainid;
        jsonob["limit"] = this.pageSize;
        jsonob["page"] = this.pageIndex;
        this.$http({
          url: this.$http.adornUrl("/hotel/agreement-commission/list"),
          method: "get",
          params: this.$http.adornParams({
            ...jsonob
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list;
            this.totalPage = data.page.sum;
            this.pageIndex = data.page.page;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },
      getAgreementCheckList() {
        if (this.searchTAgreementCheckForm.jyDate != null) {
          this.searchTAgreementCheckForm.checkDate = this.searchTAgreementCheckForm.jyDate[0];
          this.searchTAgreementCheckForm.departureDate = this.searchTAgreementCheckForm.jyDate[1];
        }
        this.dataListLoading = true;
        this.searchTAgreementCheckForm.agreementId = this.mainid;
        this.searchTAgreementCheckForm.limit = this.pageSize;
        this.searchTAgreementCheckForm.page = this.pageIndex;
        var jsonob = {};
        if (this.searchTAgreementCheckForm.jyDate != null) {
          jsonob["checkDate"] = this.searchTAgreementCheckForm.checkDate;
          jsonob["departureDate"] = this.searchTAgreementCheckForm.departureDate;
        } else {
          jsonob["checkDate"] = '';
          jsonob["departureDate"] = '';
        }
        if (this.searchTAgreementCheckForm.guestName != null) {
          jsonob["guestName"] = this.searchTAgreementCheckForm.guestName;
        }
        if (this.searchTAgreementCheckForm.roomNumber != null) {
          jsonob["roomNumber"] = this.searchTAgreementCheckForm.roomNumber;
        }
        jsonob["agreementId"] = this.mainid;
        jsonob["limit"] = this.pageSize;
        jsonob["page"] = this.pageIndex;
        this.$http({
          url: this.$http.adornUrl("/hotel/thotelfloorroomcheckinsingle/getAgreemList"),
          method: "get",
          params: this.$http.adornParams({
            ...jsonob
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list;
            this.totalPage = data.page.size;
            //this.pageIndex = data.page.page;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },
      getAgreementContactsList() {
        this.dataListLoading = true;
        this.searchTAgreementContactsForm.agreementId = this.mainid;
        this.searchTAgreementContactsForm.limit = this.pageSize;
        this.searchTAgreementContactsForm.page = this.pageIndex;
        this.$http({
          url: this.$http.adornUrl("/hotel/agreement-contacts/list"),
          method: "get",
          params: this.searchTAgreementContactsForm
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list;
            this.totalPage = data.page.sum;
            this.pageIndex = data.page.page;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },
      agreedrate(row) {
        this.id = row.id;
        this.item = row;
        this.showagreedrate = true;
      },
      cancelReturn() {
        this.pageSize = 10;
        if (this.tablekey == 1) {
          this.addAgreementVisible = false;
          this.getDataAgreementList();
        } else if (this.tablekey == 2) {
          this.addContactsVisible = false;
          this.getAgreementContactsList();
        } else if (this.tablekey == 4) {
          this.addyskVisible = false;
          this.getysklist();
        }

      },
      showAgreement(id, val) {
        if (id == "" || id == undefined) {
          this.dialogStatus = "create";
        } else {
          this.dialogStatus = "update";
        }
        if (this.dialogStatus == "create") {
          if (val == 1) {
            this.id = "";
            this.addAgreementVisible = true;
          } else if (val == 2) {
            this.id = "";
            this.addContactsVisible = true;
          }

        } else {
          if (val == 1) {
            this.id = id;
            this.addAgreementVisible = true;
          } else if (val == 2) {
            this.id = id;
            this.addContactsVisible = true;
          }

        }
      },
      getDataAgreementList() {
        this.agreementFrom.agreementId = this.mainid;
        this.agreementFrom.limit = this.pageSize;
        this.agreementFrom.page = this.pageIndex;
        this.dataListLoading = true;
        this.$http({
          url: this.$http.adornUrl("/hotel/agreement-customer/list"),
          method: "get",
          params: this.agreementFrom
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list;
            this.totalPage = data.page.sum;
            this.pageIndex = data.page.page;
          } else {
            this.dataList = [];
            this.totalPage = 0;
          }
          this.dataListLoading = false;
        });
      },
      cancelReturnagrdddrate() {
        this.showagreedrate = false;
      },

      // 每页数
      sizeChangeHandle(val) {
        this.pageSize = val;
        this.pageIndex = 1;
        if (this.tablekey == '1') {
          this.getDataAgreementList();
        } else if (this.tablekey == '2') {
          this.getAgreementContactsList();
        } else if (this.tablekey == '3') {
          if (this.indexs = '0') {
            this.commissionhandleFilter("1");
          } else {
            this.commissionzffsFilter();
          }

        } else if (this.tablekey == '4') {
          if (this.index == '0') {
            this.getysklist();
          } else if (this.index == '1') {
            this.getsettlementList();
          } else {
            this.getlistRzlist();
          }
        } else if (this.tablekey == '5') {
          this.getlistRzlist();
        } else if (this.tablekey == '6') {
          this.checkFilter();
        }
      },
      // 当前页
      currentChangeHandle(val) {
        this.pageIndex = val;
        if (this.tablekey == '1') {
          this.getDataAgreementList();
        } else if (this.tablekey == '2') {
          this.getAgreementContactsList();
        } else if (this.tablekey == '3') {
          if (this.indexs = '0') {
            this.commissionhandleFilter("1");
          } else {
            this.commissionzffsFilter();
          }

        } else if (this.tablekey == '4') {
          if (this.index == '0') {
            this.getysklist();
          } else if (this.index == '1') {

          } else {
            this.getlistRzlist();
          }
        } else if (this.tablekey == '5') {

        } else if (this.tablekey == '6') {
          this.checkFilter();
        }
      },
      // 多选
      selectionChangeHandle(val) {
        this.dataListSelections = val;
      },
      handleOpen(key) {
        this.pageSize = 10;
        this.pageIndex = 1;
        this.tablekey = key;
        if (key == 1) {
          this.getDataAgreementList();
        } else if (key == 2) {
          this.getAgreementContactsList();
        } else if (key == 3) {
          this.commissionhandleFilter("1");
        } else if (key == 4) {
          this.getysklist();
        } else if (key == 5) {
          this.getlistRzlist();
        } else if (key == 6) {
          this.checkFilter();

        }
      },
      toggleCollapse() {
        this.isCollapse = !this.isCollapse
      },
      // 删除
      deleteAgreement(id, type) {
        if (type == 1) {
          this.delectcustimer(id);
        } else if (type == 2) {
          this.delectcontacts(id);
        } else if (type == 2) {
          this.delectcommission(id);
        }

      },

      delectcontacts(id) {
        var ids = id ? [id] :
          this.dataListSelections.map(item => {
            return item.id;
          });
        this.$confirm(
          `确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
          "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          }
        ).then(() => {
          this.$http({
            url: this.$http.adornUrl("/hotel/agreement-contacts/delete/" + ids),
            method: "post"

          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500,
                onClose: () => {
                  this.getAgreementContactsList();
                }
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        });
      },

      delectcustimer(id) {
        var ids = id ? [id] :
          this.dataListSelections.map(item => {
            return item.id;
          });
        this.$confirm(
          `确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
          "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          }
        ).then(() => {
          this.$http({
            url: this.$http.adornUrl("/hotel/agreement-customer/delete/" + ids),
            method: "post"

          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500,
                onClose: () => {
                  this.getDataAgreementList();
                }
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        });
      },
      // 表单提交
      savesubmit(type) {
        if (type == 2) {
          if (this.dataForm.consumeId == '-1') {
            if (this.countnum <= 0) {
              this.$message.error("请选择右边类型");
              return false
            }
          }
        }

        this.dataForm.agreementId = this.mainid;
        this.dataForm.customerName = this.customerName;
        this.dataForm.banksNumber = this.agreementNo;
        this.dataForm.payType = type;
        this.dataForm.sign = JSON.stringify(this.shopDataList.filter(item => item.count > 0)),
          this.$refs['dataForm'].validate(valid => {
            if (valid) {
              this.$http({
                url: this.$http.adornUrl(
                  `/hotel/thotelfloorroomcheckinaccounting/${!this.dataForm.id ? "saveAgreement" : "update"}`
                ),
                method: "post",
                data: this.dataForm
              }).then(({
                data
              }) => {
                if (data && data.code === 0) {
                  this.$message({
                    message: "操作成功",
                    type: "success",
                    duration: 1500,
                    onClose: () => {
                      this.addrz = false;
                      this.getlistRzlist();
                    }
                  });
                } else {
                  this.$message.error(data.msg);
                }
              });
            }
          });
      },
      dayin() {

        var number = 0;
        for (var i = 0; i < this.tableHeader.length; i++) {
          if (this.selectedColumn[this.tableHeader[i].name]) {
            number += 1;
          }
        }

        var style = [
          '<style>',
          'body{font-size: 12px; color: #666;}',
          'table{width: 100%; border-collapse: collapse; border-spacing: 0;border-bottom:1px solid #ccc;}',
          'th,td{line-height: 20px; padding: 9px 15px; border: 1px solid #ccc;  text-align: right; font-size: 12px; color: #666;}',
          'a{color: #666; text-decoration:none;}',
          '*.layui-hide{display: none}',
          '</style>'
        ].join('');
        //头部html
        var table =
          '<table cellspacing="0" cellpadding="0" border="0" class="el-table__header" style="width:100%;"><thead class="has-gutter"><tr class="">';
        table +=
          '<th style="text-align:center; width:100%; line-height:38px;font-size:20px;font-weight:bold;" colspan="' +
          number + '" >未结算明细统计</th>';

        table += '</tr><tr class="">';
        this.tableHeader.forEach((item, index) => {
          if (this.selectedColumn[item.name]) {
            table +=
              '<th colspan="1" rowspan="1" class="el-table_1_column_2  is-center is-leaf"><div class="cell">' +
              item.name + '</div></th>';
          }
        });
        table += '</tr></thead><tbody>';
        //身体
        this.dataList.forEach((item, index) => {

          table += '<tr class="">';
          if (this.selectedColumn["发生时间"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.creatTime + '</span></div>' + '</td>';
          }
          if (this.selectedColumn["账号"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.banksNumber + '</span></div>' + '</td>';

          }
          if (this.selectedColumn["项目名称"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.cname + '</span></div>' + '</td>';

          }
          if (this.selectedColumn["客户名称"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.customerName + '</span></div>' + '</td>';

          }
          if (this.selectedColumn["房间号"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.roomSignNum + '</span></div>' + '</td>';

          }
          if (this.selectedColumn["金额"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.payPrice + '</span></div>' + '</td>';

          }
          if (this.selectedColumn["冲账金额"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.hcMoney + '</span></div>' + '</td>';

          }
          if (this.selectedColumn["剩余金额"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.sumsyje + '</span></div>' + '</td>';

          }
          if (this.selectedColumn["备注"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.remarks + '</span></div>' + '</td>';

          }
          table += '</tr>';

          console.log(item);
        });
        table += '<tr class="">';
        if (this.selectedColumn["发生时间"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span>合计</span></div>' + '</td>';
        }
        if (this.selectedColumn["账号"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span></span></div>' + '</td>';

        }
        if (this.selectedColumn["项目名称"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span></span></div>' + '</td>';

        }
        if (this.selectedColumn["客户名称"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span></span></div>' + '</td>';

        }
        if (this.selectedColumn["房间号"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span></span></div>' + '</td>';

        }
        if (this.selectedColumn["金额"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span>' + this.summoney + '</span></div>' + '</td>';

        }
        if (this.selectedColumn["冲账金额"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span>' + this.sumhcmoney + '</span></div>' + '</td>';

        }
        if (this.selectedColumn["剩余金额"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span>' + this.sumsymoney + '</span></div>' + '</td>';

        }
        if (this.selectedColumn["备注"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span></span></div>' + '</td>';

        }
        table += '</tr>';


        table += '</tbody></table>';
        table +=
          '<div style="width: 100%;text-align: right;">' +
          '<span style="margin-right: 20px;">打印时间：' +
          this.moment(new Date()) +
          '</span>' +
          '<span>打印人：' +
          this.$store.state.user.name +
          '</span>' +
          '</div>';

        var iframe = document.getElementById('print-iframe');
        var doc = null;
        document.body.appendChild(iframe);
        doc = iframe.contentWindow.document;
        doc.write(style + table);
        doc.close();
        iframe.contentWindow.focus();
        iframe.contentWindow.print();
        if (navigator.userAgent.indexOf('MSIE') > 0) {
          document.body.removeChild(iframe);
        }
      },


      dayin1() {

        var number = 0;
        for (var i = 0; i < this.tableHeaders.length; i++) {
          if (this.selectedColumns[this.tableHeaders[i].name]) {
            number += 1;
          }
        }

        var style = [
          '<style>',
          'body{font-size: 12px; color: #666;}',
          'table{width: 100%; border-collapse: collapse; border-spacing: 0;border-bottom:1px solid #ccc;}',
          'th,td{line-height: 20px; padding: 9px 15px; border: 1px solid #ccc;  text-align: right; font-size: 12px; color: #666;}',
          'a{color: #666; text-decoration:none;}',
          '*.layui-hide{display: none}',
          '</style>'
        ].join('');
        //头部html
        var table =
          '<table cellspacing="0" cellpadding="0" border="0" class="el-table__header" style="width:100%;"><thead class="has-gutter"><tr class="">';
        table +=
          '<th style="text-align:center; width:100%; line-height:38px;font-size:20px;font-weight:bold;" colspan="' +
          number + '" >未结算明细统计</th>';

        table += '</tr><tr class="">';
        this.tableHeaders.forEach((item, index) => {
          if (this.selectedColumns[item.name]) {
            table +=
              '<th colspan="1" rowspan="1" class="el-table_1_column_2  is-center is-leaf"><div class="cell">' +
              item.name + '</div></th>';
          }
        });
        table += '</tr></thead><tbody>';
        //身体
        this.dataList.forEach((item, index) => {

          table += '<tr class="">';
          if (this.selectedColumns["发生时间"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.creatTime + '</span></div>' + '</td>';
          }
          if (this.selectedColumns["账号"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.agreementNo + '</span></div>' + '</td>';

          }
          if (this.selectedColumns["客户名称"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.customerName + '</span></div>' + '</td>';

          }
          if (this.selectedColumns["金额"]) {
            table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
              '<span>' + item.receiptsMoney + '</span></div>' + '</td>';

          }

          table += '</tr>';

          console.log(item);
        });
        table += '<tr class="">';
        if (this.selectedColumns["发生时间"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span>合计</span></div>' + '</td>';
        }
        if (this.selectedColumns["账号"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span></span></div>' + '</td>';

        }
        if (this.selectedColumns["客户名称"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span></span></div>' + '</td>';

        }
        if (this.selectedColumns["金额"]) {
          table += '<td rowspan="1" colspan="1" class="el-table_1_column_2 is-center ">' + '<div class="cell">' +
            '<span>' + this.summoney + '</span></div>' + '</td>';

        }

        table += '</tr>';


        table += '</tbody></table>';
        table +=
          '<div style="width: 100%;text-align: right;">' +
          '<span style="margin-right: 20px;">打印时间：' +
          this.moment(new Date()) +
          '</span>' +
          '<span>打印人：' +
          this.$store.state.user.name +
          '</span>' +
          '</div>';

        var iframe = document.getElementById('print-iframe');
        var doc = null;
        document.body.appendChild(iframe);
        doc = iframe.contentWindow.document;
        doc.write(style + table);
        doc.close();
        iframe.contentWindow.focus();
        iframe.contentWindow.print();
        if (navigator.userAgent.indexOf('MSIE') > 0) {
          document.body.removeChild(iframe);
        }
      },

      moment(date) {
        return moment(date).format('YYYY-MM-DD');
      },





    }
  }
</script>
<style lang="scss" scoped>
  #home {
    width: 100%;
    height: 100%;

    .el-container {
      height: 100%;
    }

    .el-menu-vertical-demo:not(.el-menu--collapse) {
      width: 200px;
      min-height: 400px;
    }

    .toggle {
      font-size: 36px;
      color: #989898;
      cursor: pointer;
      line-height: 30px;
    }

    .el-menu-item {
      background: white;
      color: #303133;

      &.is-active {
        color: #17B3A3;
      }
    }

    /deep/ .el-form-item__content {
      .el-date-editor {
        padding-right: 0;
      }

      .el-range-separator {
        width: 22px;
      }
    }
  }
</style>
